$(function(){
	
	var $btnAdd = $('#btnSave');
	$btnAdd.click(function(){
		bonusTypeSave();
	});
	
});

function bonusTypeSave(){

	
	var $type_id 			= $('#type_id');
	var $bonus_name 		= $('#bonus_name');
	var $bonus_money 		= $('#bonus_money');
	var $min_goods_amount 	= $('#min_goods_amount');
	var $remark 			= $('#remark');
	var $begin 				= $('#begin');
	var $end 				= $('#end');
	var $disabled 			= $('#disabled');

	var type_id				= $type_id.val();
	var bonus_name 			= $bonus_name.val();
	var bonus_money 		= $bonus_money.val();
	var min_goods_amount	= $min_goods_amount.val();
	var remark				= $remark.val();
	var begin				= $begin.val();
	var end					= $end.val();
	var disabled			= $('input[name="disabled"]:checked').val();
	var id					= $('#id').val();
	
	var params = {
		'id'				:id,
		'type_id'			:type_id,
		'bonus_name'		:bonus_name,
		'bonus_money'		:bonus_money,
		'min_goods_amount'	:min_goods_amount,
		'remark'			:remark,
		'begin'				:begin,
		'end'				:end,
		'disabled'			:disabled
	}

	$.post('/index.php/Admin/Bonus/update',params,function(data){
		if(data.success){
			alert('礼券分类编辑成功');
			location.reload(true);
		}else{
			alert('礼券分类编辑失败');
		}
	},'json');
}